package method;//按正序打印数的每一位
import java.util.Scanner;

public class test {
    public static void main(String[] args) {
        System.out.println("请输入一个整数:");
        Scanner scanner = new Scanner(System.in);
        int input = scanner.nextInt();
        System.out.println(num_add(input));
}
    public static int num_add(int n) {
        int sum = 0;
        if(n < 10){
           return n;
        }
        else
           return num_add(n / 10) + n % 10;
    }
}

